<!DOCTYPE html>
<title>Test that setting currentTime changes the time, and that "ended" event is fired in a reasonable amount of time.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");

    video.oncanplaythrough = t.step_func(function () {
        video.oncanplaythrough = null;
        video.onended = t.step_func_done();
        assert_equals(video.currentTime, 0);
        video.currentTime = video.duration - 0.2;
    });

    video.onseeked = t.step_func(function () {
        assert_equals(video.currentTime.toFixed(2), (video.duration - 0.2).toFixed(2));
        video.play();
    });

    video.src = "content/test.ogv";
});
</script>